package com.ysy.controller;

import com.ysy.entity.dto.NoteOnlyReq;
import com.ysy.entity.dto.NoteReqDTO;
import com.ysy.entity.dto.NoteTopReq;
import com.ysy.entity.vo.NoteLikeReqVo;
import com.ysy.entity.vo.NoteReqDetail;
import com.ysy.entity.vo.NoteUnLikeReqVo;
import com.ysy.persimmons.common.response.Response;
import com.ysy.service.NoteService;
import jakarta.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 笔记表 前端控制器
 * </p>
 *
 * @author yangSy
 * @since 2025-04-23
 */
@RestController
public class NoteController {

    private static final Logger log = LoggerFactory.getLogger(NoteController.class);

    @Resource
    private NoteService noteService;



    @PostMapping("/add")
    public Response<?> addNote(@RequestBody NoteReqDTO note) {
      return  noteService.addNote(note);
    }

    @PostMapping("/del")
    public Response<?> delNote(@RequestBody NoteReqDetail  delNote) {
        return  noteService.delNote(delNote);
    }

    @PostMapping("/update")
    public Response<?> updateNote(@RequestBody NoteReqDTO note) {
        return  noteService.updateNote(note);
    }

    @PostMapping("/select")
    public Response<?> selectNote(@RequestBody NoteReqDTO note) {
        return  noteService.selectNote(note);
    }

    @PostMapping("/select/detail")
    public Response<?> selectDetailNote(@RequestBody NoteReqDetail note) {
        return  noteService.selectDetailNote(note);
    }

    @PostMapping("/only/me")
    public Response<?> onlyMe(@RequestBody NoteOnlyReq note) {
        return  noteService.updateOnlyMe(note);
    }
    @PostMapping("/top")
    public Response<?> top(@RequestBody NoteTopReq note) {
        return  noteService.updateTop(note);
    }



    @PostMapping("/like")
    public Response<?> noteLike(@RequestBody NoteLikeReqVo likeReqVo) {
        return  noteService.like(likeReqVo);
    }

    @PostMapping("/unlike")
    public Response<?> noteUnLike(@RequestBody NoteUnLikeReqVo unLikeReqVo) {
        return  noteService.unLike(unLikeReqVo);
    }



}
